#include "ustandard/ustandard.h"
int krunning = 1;
void sigroutine(int dunno)
{
    switch(dunno) {
        case SIGINT:
        krunning = 0;
        break;
    }
}
int main()
{
    void* buf = malloc(1024*1024);
    void* buf_src = malloc(1024*1024);
    size_t size;
    uint64_t total = 0;
    struct timeval tvs;
    struct timeval tve;
    signal(SIGINT, sigroutine);
    gettimeofday(&tvs, NULL);
    while(krunning) {
        size = urandft(1, 100*1024);
        memcpy(buf, buf_src, size);

        total += size;
    }
    gettimeofday(&tve, NULL);

    int64_t usec = utv_count(&tvs, &tve); 
    double sec = (double)usec / (double)1000000;
    double speed = (double)(total / (uint64_t)(1024*1024)) / sec;

    printf("in %lf sec , copy %llu. speed : %.02lfMB/s\n", sec, total, speed);

    return 0;
}
